﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using Microsoft.Extensions.DependencyInjection;

namespace OOP
{
    class ReflexDemo1
    {
        //static void Main(string[] args)
        //{
        //    Tank tank = new Tank();
        //    //使用反射来获取对象实例，调用实例的成语
        //    var t = tank.GetType();
        //    Object o = Activator.CreateInstance(t);
        //    MethodInfo m1 = t.GetMethod("Fire");
        //    MethodInfo m2 = t.GetMethod("Run");
        //    m1.Invoke(o, null);
        //    m2.Invoke(o, null);                    
        //}       
    }

    class Tank
    {
        public void Fire() 
        {
            Console.WriteLine("Boom!!!");
        }
        public void Run()
        {
            Console.WriteLine("Run!!!");
        }
    }
}
